package com.crm.entity;

import java.io.Serializable;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.GenericGenerator;



@Entity
@Table(name="user")
public class User implements Serializable{
	private static final long serialVersionUID = 1L;
	
	@Id
	@GeneratedValue(generator="increment")
	@GenericGenerator(name="increment", strategy = "increment")
	@Column(name="id")
	private int id;
	
	
	@ManyToOne
	@JoinColumn(name="business_id")
	private Business business;
	
	//@NotEmpty(message="User Name Must Not Be Empty")
	@Column(name="uname")
	private String userName;
	
	//@NotEmpty(message="Role Is Required")
	@Column(name="role")
	private int role;
	
	
	//@NotEmpty(message="Password Is Needed")
	@Column(name="pwd")
	private String password;
	
	//@NotEmpty(message="First name Is Needed")
	@Column(name="first_name")
	private String firstName;
	
	//@NotEmpty(message="Last Name Is Needed")
	@Column(name="last_name")
	private String lastName;
	
	//@NotEmpty(message="Email Id Is Needed")
	@Column(name="email_id")
	private String email;
	
	//@NotEmpty(message="Email Password Is Needed")
	@Column(name="email_pwd")
	private String emailPwd;
	
	
	@Column(name="is_deleted")
	private boolean isDeleted;
	
	public User(){
		super();
	}
	public User(Business business,String userName,String password,String firstName,String lastName,String email,String emailPwd){
		this.business=business;
		this.userName=userName;
		this.password=password;
		this.firstName=firstName;
		this.lastName=lastName;
		this.email=email;
		this.emailPwd=emailPwd;
		/*this.role=role;*/
	}
	
	public User(int id,Business business,String userName,String password,String firstName,String lastName,String email,String emailPwd,int role){
		this.id=id;
		this.business=business;
		this.userName=userName;
		this.password=password;
		this.firstName=firstName;
		this.lastName=lastName;
		this.email=email;
		this.emailPwd=emailPwd;
		this.role=role;
	}
	
	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public Business getBusiness() {
		return business;
	}

	public void setBusinessId(Business business) {
		this.business = business;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	public String getEmailPwd() {
		return emailPwd;
	}
	public void setEmailPwd(String emailPwd) {
		this.emailPwd = emailPwd;
	}
	public void setBusiness(Business business) {
		this.business = business;
	}
	public int getRole() {
		return role;
	}
	public void setRole(int role) {
		this.role = role;
	}
	public boolean isDeleted() {
		return isDeleted;
	}
	public void setDeleted(boolean isDeleted) {
		this.isDeleted = isDeleted;
	}
	
}
